//
//  transforms.hpp
//  yuzon
//
//  Created by Alvin on 2023/3/29.
//

#pragma once

#include <opencv2/opencv.hpp>

void transform_preds(const std::vector<float> &coords,
                     const cv::Point2f &center,
                     const cv::Size2f &scale,
                     const cv::Size2f &output_size,
                     std::vector<float> &preds);

cv::Mat get_affine_transform(const cv::Point2f &center,
                             const cv::Size2f &scale,
                             float rot,
                             const cv::Size2f &output_size,
                             int inv);

cv::Mat affine_tranform(const cv::Point2f &pt, const cv::Mat &t);

cv::Point2f get_3rd_point(const cv::Point2f &a, const cv::Point2f &b);

cv::Point2f get_dir(const cv::Point2f &src_point, float rot_rad);

void get_final_preds(const std::vector<float> &heatmaps,
                     const std::vector<int64_t> &dims,
                     const std::vector<int64_t> &indexes,
                     const cv::Point2f &center,
                     const cv::Size2f scale,
                     std::vector<float> &preds,
                     bool dark);

void dark_parse(const std::vector<float> &heatmap,
                std::vector<float> &coords,
                int w, int h, int px, int py, int i);
